package com.byght.bygsystem.service;

import com.byght.bygsystem.mapper.PersonnelMapper;
import com.byght.bygsystem.model.Personnel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PersonnelService {

    @Autowired
    private PersonnelMapper personnelMapper;

    public List<Personnel> getAllPersonnel() {
        return personnelMapper.findAll();
    }

    public Personnel getPersonnelById(int id) {
        return personnelMapper.findById(id);
    }

    public void addPersonnel(Personnel personnel) {
        personnelMapper.insert(personnel);
    }

    public void updatePersonnel(Personnel personnel) {
        personnelMapper.update(personnel);
    }

    public void deletePersonnel(int id) {
        personnelMapper.delete(id);
    }
}
